home *** CD-ROM | disk | FTP | other *** search
/ Windows 32-Bit Gallery / Windows 32-bit Gallery.iso / win95 / winbatch / filesize.wb_ < prev    next >
Text File  |  1996-11-20  |  2KB  |  66 lines

  1.    
  2. ;DIRSIZE
  3. ;This file traverses the directory tree and computes the total
  4. ;size of all files on the drive.
  5. ;
  6.         DirChange("C:\")
  7.         BoxOpen("File Size Inspector","Reading Initial Directories")
  8.         tot = FileSize(FileItemize("*.*"))
  9.         sub1 = DirItemize("*.*")
  10.         totdir=0
  11.         level=1
  12.         dir1=DirGet()
  13.         numdir1 = ItemCount(sub1, " ")
  14.         index1 = 0
  15.   
  16.         :dsloop
  17.         If index%level% == numdir%level% Then Goto upalevel
  18.         index%level% = index%level% + 1
  19.         DirChange(StrCat(dir%level%, ItemExtract(index%level%, sub%level%, " ")))
  20.         BoxText(strcat("Level=",level,@crlf,"Total=",tot,@crlf,dir%level%))
  21.         totdir=totdir+1
  22.         tot = tot + FileSize(FileItemize("*.*"))
  23.         level = level + 1
  24.         dir%level% = DirGet()
  25.         sub%level% = DirItemize("*.*")
  26.         numdir%level% = ItemCount(sub%level%, " ")
  27.         index%level% = 0
  28.         goto dsloop
  29.   
  30.         :upalevel
  31.         drop(dir%level%,sub%level%,index%level%,numdir%level%)
  32.         level=level-1
  33.         if level!=0 then goto dsloop
  34.  
  35.         ; -----------
  36.         ; Termination
  37.         ; -----------
  38.         BoxShut()
  39.         If StrLen(tot) < 9 Then tot = StrCat(StrFill("", 9 - StrLen(tot)), tot)
  40.         tot = StrCat(StrSub(tot,1,3),",",StrSub(tot,4,3),",",StrSub(tot,7,3))
  41.         tot = StrTrim(tot)
  42.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  43.         tot = StrTrim(tot)
  44.         If StrSub(tot, 1, 1) == "," Then tot = StrSub(tot, 2, StrLen(tot) - 1)
  45.         tot = StrTrim(tot)
  46.         Message("%totdir% Subdirectories included", "Total size %tot% bytes.")
  47.         Exit
  48.    
  49.    
  50.    
  51.    
  52.    
  53.    
  54.    
  55.    
  56.    
  57.    
  58.    
  59.    
  60.    
  61.    
  62.    
  63.    
  64.    
  65.    
  66.